<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>

<div class="easyui-layout" fit="true">

    <div region="center" style="padding:0px;border:0px">
       <table style="width: 100%;" cellpadding="0" cellspacing="1"  border="0" class="formtable" align="center">
	       <tr height="30" >
				<td width="50"  class="value">
				    <select name="pmd" id="pmd" style="width:90px;">	
				         <option value="customerNo">户号</option>
				         <option value="customerName">户名</option>
			        </select>
			        
				</td>
				<td  width="50"  class="value">
				   <input type="text" name="pmv" id="pmv" style="width:150px;">
				</td>
				<td width="100"  align="center" >
				           电费查询方式
				</td>
				<td width="150"  class="value">
				    <t:dictSelect field="queryMode"  id="queryMode" typeGroupCode="elecQuery" hasLabel="false" defaultVal="" ></t:dictSelect>
				</td>
				<td>
				   <a href="#" class="easyui-linkbutton"  plain="true" iconCls="icon-search"  style="margin-left:5px;" onclick="myquery();" >查 询</a>
					
				</td>
				<td align="right" style="padding-right:20px;">
					<c:forEach var="queryMode" items="${queryModeCount }" varStatus="status"> 
						${queryMode.querymode_desc }：<span style="color:red;">${queryMode.cnt }</span>户&nbsp;&nbsp;
					</c:forEach>
					 
				</td>
			</tr>
		 </table>
      <div region="center" style="padding:0px;border:0px;height:90%;width:100%;">
        <t:datagrid name="customerNoListGrid" title=""
                    actionUrl="groupPRController.do?customerNoGrid&groupid=${groupid}" idField="id" checkbox="true"  sortOrder="asc" sortName="sno" >
            <t:dgCol title="" field="id" hidden="true"></t:dgCol>
            <t:dgCol title="排序号" field="sno" width="40"></t:dgCol>
            <t:dgCol title="户号" field="customerNo" width="80"></t:dgCol>
            <t:dgCol title="查询方式" field="queryModeDesc" width="40"></t:dgCol>
            <t:dgCol title="户名" field="customerName" width="120"></t:dgCol>
            <t:dgCol title="地址" field="customerAddress" width="120"></t:dgCol>
            <t:dgCol title="common.operation" field="opt" width="30"></t:dgCol>
            <t:dgDelOpt url="groupPRController.do?delCustomerNo&id={id}" title="common.delete"></t:dgDelOpt>
            <t:dgToolBar title="新增" icon="icon-add" url="groupPRController.do?aouCustomerNo&groupid=${groupid}" width="800" height="265"  funname="add"></t:dgToolBar>
            <t:dgToolBar title="编辑" icon="icon-edit" url="groupPRController.do?aouCustomerNo&groupid=${groupid}" height="265"  funname="update"></t:dgToolBar>
            <t:dgToolBar title="导入" icon="icon-put" funname="ImportXls"></t:dgToolBar>
            <t:dgToolBar title="导出" icon="icon-putout" funname="ExportXls"></t:dgToolBar>
            <t:dgToolBar title="templateDownload" icon="icon-putout" funname="ExportXlsByT"></t:dgToolBar>
            <t:dgToolBar title="批量删除" icon="icon-edit" funname="removeMore"></t:dgToolBar>
        </t:datagrid>
      </div>
    </div>
</div>
 
 
 
 <script type="text/javascript">

	//模板下载
	function ExportXlsByT() {
		JeecgExcelExport("groupPRController.do?exportXlsByCustomerNoT","customerNoListGrid");
		
	}
	
	//导入
	function ImportXls() {
		$.dialog.setting.zIndex = getzIndex(true);
		
		var  data =$('#customerNoListGrid').datagrid('getData');
		if(data.total>0){
	    	$.dialog.confirm('将会删除该集团下所有户号并重新导入，确认吗？', function(){
	    		openuploadwin('集团户号Excel导入', 'groupPRController.do?upload&groupid=${groupid}', "customerNoListGrid");
	    	}, function(){
	    	});
		}else{
			openuploadwin('集团户号Excel导入', 'groupPRController.do?upload&groupid=${groupid}', "customerNoListGrid");
		}
		
	}
	
	//导出
	function ExportXls() {
	
		JeecgExcelExport("groupPRController.do?exportCustomerNoXls&groupid=${groupid}", "customerNoListGrid");
	}
	
	function myquery(){
		 //字段选项
	    var pmd = $('#pmd').val();
		 //字段值
	    var pmv = $('#pmv').val();
		 //电费查询方式
	    var queryMode = $('#queryMode').val();
		
		$('#customerNoListGrid').datagrid({
			queryParams: {
				pmd: pmd,
				pmv: pmv,
				queryMode: queryMode
			}
		});

	}
	
	function removeMore(){
		var ids = [];
        var rows = $('#customerNoListGrid').datagrid('getSelections');
        for (var i = 0; i < rows.length; i++) {
            ids.push(rows[i]['id']);
        }
        ids.join(',');
       // console.log(ids);
        
        if(ids.length==0){
        	$.messager.alert('&nbsp;&nbsp;信息提醒','请选择要删除的户号！', 'info');
        	return;
        }
        
        $.dialog.setting.zIndex = getzIndex(true);
        $.dialog.confirm('将删除选中的户号，确认吗？', function(){
        	 $.ajax({
         		async : false,
         		cache : false,
         		type : 'POST',
         		url : "groupPRController.do?removeMoreCustomerNo&ids="+ids,
         		error : function() {// 请求失败处理函数
         		},
         		success : function(data) {
         			var d = $.parseJSON(data);    			 
         			if (d.success) {
         				$('#customerNoListGrid').datagrid('reload');		 
         			}    			
         		}
         	});
    	}, function(){
    	});
	}
	

	
	   
	
 </script>